package util;

import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;

import java.net.HttpCookie;
import java.util.HashMap;

public class RequestUtil {

    public static void main(String[] args) {
        HashMap<String, Object> paramMap = new HashMap<>();
        paramMap.put("city", "北京");

//        String result= HttpUtil.post("https://www.baidu.com", paramMap);
        HttpResponse res = HttpRequest.get("https://gl.gdedu.gov.cn/gdeducms/")
                .form("","")
                .form("","")
                .execute();

        System.out.println(res.getStatus());
        System.out.println(res.getCookies().size());
        for(int i=0;i<res.getCookies().size();i++){
            HttpCookie cookie=res.getCookies().get(i);
            System.out.println(cookie.getName()+" "+cookie.getValue());
        }
    }
}

//                .header(Header.ACCEPT,"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
//                .header(Header.ACCEPT_ENCODING,"gzip, deflate, br")
//                .header(Header.ACCEPT_LANGUAGE,"zh-CN,zh;q=0.9")
//                .header(Header.CACHE_CONTROL,"max-age=0")
//                .header(Header.CONNECTION,"keep-alive")
//                .header(Header.COOKIE,"Hm_lvt_19195218a9027e35281cd0b4f5a0de3c=1663902443,1663914762; uinfo=\"rROzphTNeC11pAn/CheRbUhV0nomzDg7w/6lCTEXrBI0yPM+zmLS8IyjJIqGi/f1+h/LHcIteZSQR7/znrLICQ==\"; Hm_lpvt_19195218a9027e35281cd0b4f5a0de3c=1663915954")
//                .header(Header.HOST,"gl.gdedu.gov.cn")
//                .header("If-Modified-Since","Mon, 01 Mar 2021 09:01:56 GMT")
//                .header("If-None-Match","W/\"1945-1614589316000\"")
//                .header(Header.REFERER,"https://gl.gdedu.gov.cn/uc/j_hh_security_logout")
//                .header("sec-ch-ua","\"Chromium\";v=\"104\", \" Not A;Brand\";v=\"99\", \"Google Chrome\";v=\"104\"")
//                .header("sec-ch-ua-mobile","?0")
//                .header("sec-ch-ua-platform","\"Windows\"")
//                .header("Sec-Fetch-Dest","document")
//                .header("Sec-Fetch-Mode","navigate")
//                .header("Sec-Fetch-Site","same-origin")
//                .header("Sec-Fetch-User","?1")
//                .header("Upgrade-Insecure-Requests","1")
//                .header(Header.USER_AGENT,"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36")
